<?php
include_only();

$videos = get_all_videos();
//print_r($videos);

if(!empty($add) and $add=='yes')
{
$user_info = get_user_info();
$user_id = $user_info['id'];
add_video_to_favourites($video_id, $user_id);
$message= 'DONE';
}

$all_videos = "
<table border='0' cellspacing='3' cellpadding='2'>
<tr>
<td>#</td>
<td><b>title</b></td>
<td><b>description</b></td>
<td></td>
</tr>
";

for ($i = 0; $i <= count($videos)-1; $i++) {
$index = $i + 1;
$all_videos = $all_videos . "
<tr>
<td>". $index ."</td>
<td><a href='index.php?page=video_player&video_id=".$videos[$i]['id']."'>".$videos[$i]['name']."</a></td>
<td>".$videos[$i]['desc']."</td>
<td>
<form method='post' action='index.php'>
<input type='hidden' name='page' value='videos' />
<input type='hidden' name='video_id' value='".$videos[$i]['id']."' />
<input type='hidden' name='add' value='yes' />
<input type='image' src='templates/".read_option('theme_folder')."/control/001_01.png' title='add to favourites' />
</form>
</td>
</tr>
";
}

$all_videos =  $all_videos . "
</table>
";
?>